/*
 * mypy_generator.h
 *
 *  Created on: Mar 17, 2010
 *      Author: sellers
 */

#ifndef MYPY_GENERATOR_H_
#define MYPY_GENERATOR_H_

#include <iostream>
#include <fstream>
#include <sstream>

#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/descriptor.h"


class BabelSnakeGenerator : public google::protobuf::compiler::CodeGenerator
{
	private:

		bool handle_msg(const ::google::protobuf::Descriptor *descriptor,
				        ::std::string &indent,
				        ::std::stringstream &swigInput,
				        ::std::stringstream &forwardClassInput,
				        ::std::stringstream &enumInput) const;
		bool handle_enum(const ::google::protobuf::EnumDescriptor *descriptor,
		                 ::std::string &indent,
				         ::std::stringstream &enumInput) const;
		bool handle_field(const ::google::protobuf::FieldDescriptor *descriptor,
				        ::std::string &indent,
				        ::std::stringstream &swigInput,
				        ::std::stringstream &extensionInput) const;

		bool run_swig(::std::string inputfilename, ::std::string *error) const;

	public:
		explicit BabelSnakeGenerator();
		~BabelSnakeGenerator();

		bool Generate(const ::google::protobuf::FileDescriptor *file,
					  const ::std::string &parameter,
					  google::protobuf::compiler::OutputDirectory  *output_directory,
					  ::std::string *error) const;
};


#endif /* MYPY_GENERATOR_H_ */
